// pages/breakDown/breakDown.js
import {
  request
} from '../../request/index.js'
const app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    id:1,
    http:'',
    user:{},
    breakList:[]
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    let user = typeof wx.getStorageSync('user')==='string'? JSON.parse(wx.getStorageSync('user')):wx.getStorageSync('user');
    this.setData({
      http: app.globalData.http,
      user
    });
    this.getData();

  },
  getData(){
    request({
      url:'SplitRecord/getUserFenCheng',
      data: {
        split_user_id:this.data.user.user_id,
        split_method:this.data.id    
      }
    }).then((result) => {
      console.log(result);
      this.setData({
        breakList:result.data.data.reverse()
      })
    })
  },
  tabClick(e){
    this.setData({
      id:e.currentTarget.dataset.id
    });
    this.getData();
  }
})